package com.javaapi.util;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;

public class CmdGetSystemInfo {
	public static String getMac() {
		String macSerial = null;
		String str = "";
		try {
			// Process pp =
			// Runtime.getRuntime().exec("cat /sys/class/net/wlan0/address ");
			// Process pp =
			// Runtime.getRuntime().exec("adb shell  cat /sys/class/net/wlan0/address  ");
			Process pp = Runtime.getRuntime().exec("adb shell cat /proc/cpuinfo ");
			InputStreamReader ir = new InputStreamReader(pp.getInputStream());
			LineNumberReader input = new LineNumberReader(ir);
			for (; null != str;) {
				str = input.readLine();
				if (str != null) {
					macSerial = str.trim();// 去空格
					break;
				}
			}
		} catch (IOException ex) {
			// 赋予默认值
			ex.printStackTrace();
		}
		return macSerial;
	}

	public static void main(String[] args) {
		// getMac();
		System.out.println(getMac());
	}
}
